package com.insideClass.Queue;

import com.insideClass.typeinfo.Pet;
import com.insideClass.typeinfo.Pets;

import java.util.Iterator;

/**
 * @author 13699
 */
class PetSequnce{
    protected Pet[] pets= Pets.createArray(8);
}
/**
 * @author 13699
 */
public class NonCollectionSequence extends PetSequnce{
    public Iterator<Pet> iterator(){
        return new Iterator<Pet>() {
          private int index=0;
            @Override
            public boolean hasNext() {
                return index<pets.length;
            }
            @Override
            public Pet next() {
                return pets[index++];
            }
            @Override
            public void remove(){
                throw new UnsupportedOperationException();
            }
        };
    }

    public static void main(String[] args) {
        NonCollectionSequence nc=new NonCollectionSequence();
        InterfaceVsIterator.display(nc.iterator());
    }
}
